#include "TaskQueue.h"
#include "ThreadPool.h"
#include <memory>
#include <iostream>
#include <functional>

using namespace std;

class MyTask
{
public:
    void process(int x) {
        srand(clock());
        int num = rand() % 100;
        cout << "num = " << num << endl;
    }
};

int main()
{
    ThreadPool thpool(4,10);
    thpool.start();

    unique_ptr<MyTask> task(new MyTask()); 
    int cnt = 20;
    while(cnt--){
        thpool.addTask(bind(&MyTask::process,task.get(),1));
        cout << "cnt = " << cnt << endl;
    }

    thpool.stop();
    return 0;
}

